Skip to content

Conversation

@Swatinem
Copy link
Contributor

This is my attempt at fixing #105489.

It adds a new JSON array with the list of test vectors to the end of the mcdc_records.
I also bumped the json format version accordingly, which I believe wasn’t done properly in the past when new fields were added.

Unfortunately, the MCDCRecord only contains the executed test vectors, not all the relevant ones.
Still for forward compatibility, it still adds an executed: true field. So if in the future LLVM is able to output all relevant test vectors, one can emit those as well using executed: false.

I also had to resort to a const_cast because the it looks like the PosToID mapping is mutated when reading from it 🙄. If I see it correctly, this shouldn’t pose a problem, as the only concurrency here seems to be related to processing multiple files in parallel, which should all have their independent copy of this PosToID mapping.

@github-actions
Copy link

github-actions bot commented Aug 21, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@Swatinem Swatinem force-pushed the mcdc-export-testvectors branch from 6910802 to 1f57500 Compare September 16, 2024 10:17
@kuzmich321
Copy link
Contributor

@EugeneZelenko Hi! Can you please help to assign the right reviewers here?

@evodius96
Copy link
Contributor

Thank you for implementing this! I wasn't aware of the outstanding issue and PR. Exporting to JSON was not an immediate need, so I appreciate the engagement in supporting the JSON more fully for MC/DC. I agree it makes sense right now to focus on executed test vectors. I will review this within the next few days.

@evodius96
Copy link
Contributor

Sorry for the long delay in reviewing this code. Thank you for your contribution to improving this. In general, LGTM. However, can you also add a test to verify the JSON output? You can extend one of the existing test files. Also, it would be good to do a rebase given the age of the PR. Thanks!

}
}

json::Array gatherTestVectors(coverage::MCDCRecord &Record) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you document your additions in the comment at the top of the file (line 23ff)?

@kuzmich321
Copy link
Contributor

kuzmich321 commented Sep 16, 2025

@Swatinem @evodius96 I decided it's just easier to cherry pick since there are a tone of conflicts on rebabasing

#159119

evodius96 pushed a commit that referenced this pull request Sep 24, 2025
It adds a new JSON array with the list of test vectors to the end of the mcdc_records.
I also bumped the json format version accordingly, which I believe wasn’t done properly in the past when new fields were added.

This PR adds tests and comment docs for
#105511

---------

Co-authored-by: Arpad Borsos <[email protected]>
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Sep 24, 2025
It adds a new JSON array with the list of test vectors to the end of the mcdc_records.
I also bumped the json format version accordingly, which I believe wasn’t done properly in the past when new fields were added.

This PR adds tests and comment docs for
llvm/llvm-project#105511

---------

Co-authored-by: Arpad Borsos <[email protected]>
@evodius96 evodius96 closed this Sep 24, 2025
@evodius96
Copy link
Contributor

Closing PR in deference to #159119 which is merged. Thanks!

mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
It adds a new JSON array with the list of test vectors to the end of the mcdc_records.
I also bumped the json format version accordingly, which I believe wasn’t done properly in the past when new fields were added.

This PR adds tests and comment docs for
llvm#105511

---------

Co-authored-by: Arpad Borsos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants